#pragma once
#include "rtda/heap/cp_memberref.h"

namespace jvm {
namespace heap {

class Method;

class InterfaceMethodRef : public MemberRef {
private:
    std::shared_ptr<Method> m_pMethod;

public:
    InterfaceMethodRef(std::shared_ptr<ConstantPool> pCp, const std::shared_ptr<classfile::ConstantMemberRefInfo> pMemberrefInfo);
    static std::shared_ptr<InterfaceMethodRef> newInterfaceMethodRef(std::shared_ptr<ConstantPool> pCp, 
        const std::shared_ptr<classfile::ConstantInterfaceMethodRefInfo> pInterfaceMethodrefInfo);
    
    std::shared_ptr<Method> resolvedInterfaceMethod();
    void resolveInterfaceMethodRef();

private:
    static std::shared_ptr<Method> lookupInterfaceMethod(std::shared_ptr<Class> pClass, const std::string& name, const std::string& descriptor);
};

} // namespace heap
} // namespace jvm

